/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package servlets;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jmysql.CArea;
import org.json.JSONObject;

/**
 *
 * @author dblack
 */
public class CConsultaArea extends HttpServlet {
    
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        doPost(request, response);
    }

  
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String tipo=request.getParameter("tipo");
	CArea c=new CArea();
	JSONObject j=new JSONObject();
		
	if(tipo.compareToIgnoreCase("ListaArea")==0)
            j=c.GetListaArea();
		
	//aca también se deben enviar datos
	
	PrintWriter out = response.getWriter();		
	response.setContentType("application/json");
	out.print(j);
	out.close();
        
    }

    
    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>
}
